﻿CREATE TRIGGER tr_Menu_Group_U_D
ON dbo.t_Menu_Group
FOR UPDATE,DELETE
AS

RETURN	
IF NOT EXISTS(SELECT * FROM deleted d
							INNER JOIN UserNameSpaceChildren() UNSC ON d.NameSpaceID = UNSC.NameSpaceID
              )BEGIN
	ROLLBACK TRAN
	DECLARE @NS nvarchar(445) SET @NS = dbo.UserNameSpace()
	RAISERROR('%s Can''t update/delete settings from upper NameSpace',16,1,@NS)
	RETURN
END
